<% layout('/layouts/default.html', {title: '机构商家分组配置管理', libs: ['validate']}){ %>
<div class="main-content">
	<div class="box box-main">
		<div class="box-header with-border">
			<div class="box-title">
				<i class="fa fa-list-alt"></i> ${text(wxBusinessGroupOrgConfig.isNewRecord ? '新增机构商家分组配置' : '编辑机构商家分组配置')}
			</div>
			<div class="box-tools pull-right">
				<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
			</div>
		</div>
		<#form:form id="inputForm" model="${wxBusinessGroupOrgConfig}" action="${ctx}/wx/wxBusinessGroupOrgConfig/save" method="post" class="form-horizontal">
			<div class="box-body">
				<div class="form-unit">${text('基本信息')}</div>
				<#form:hidden path="id"/>
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required ">*</span> ${text('分组名称')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="groupName" maxlength="200" class="form-control required"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6" style="display:none;">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required ">*</span> ${text('机构名称')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="officeCode" maxlength="200" class="form-control required"/>
							</div>
						</div>
					</div>
				</div>



				<div class="form-unit" id="sortLogo">${text('商家logo排序(商家数量少于10排序不生效)')}</div>
				<div class="row" id="sortDiv">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('排序一')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:select path="sortOne"
								items="${businessList}"
								itemLabel="name" itemValue="id" class="form-control" id="groupSel" />
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('排序二')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:select path="sortTwo"
								items="${businessList}"
								itemLabel="name" itemValue="id" class="form-control" id="groupSel" />
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('排序三')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:select path="sortThree"
								items="${businessList}"
								itemLabel="name" itemValue="id" class="form-control" id="groupSel" />
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('排序四')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:select path="sortFour"
								items="${businessList}"
								itemLabel="name" itemValue="id" class="form-control" id="groupSel" />
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('排序五')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:select path="sortFive"
								items="${businessList}"
								itemLabel="name" itemValue="id" class="form-control" id="groupSel" />
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('排序六')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:select path="sortSix"
								items="${businessList}"
								itemLabel="name" itemValue="id" class="form-control" id="groupSel" />
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('排序七')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:select path="sortSeven"
								items="${businessList}"
								itemLabel="name" itemValue="id" class="form-control" id="groupSel" />
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('排序八')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:select path="sortEight"
								items="${businessList}"
								itemLabel="name" itemValue="id" class="form-control" id="groupSel" />
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('排序九')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:select path="sortNine"
								items="${businessList}"
								itemLabel="name" itemValue="id" class="form-control" id="groupSel" />
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('排序十')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:select path="sortTen"
								items="${businessList}"
								itemLabel="name" itemValue="id" class="form-control" id="groupSel" />
							</div>
						</div>
					</div>
				</div>
				<div class="row" id="mainBusiness">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('主推商家')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:checkbox path="wxBusinessGroup.applyBusinessIds"  items="${businessList}" itemLabel="name" itemValue="id"  dictType="" class="form-control" />
							</div>
						</div>
					</div>
				</div>
				<div class="row" style="display: none">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('备注')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="remark" maxlength="200" class="form-control"/>
							</div>
						</div>
					</div>
				</div>
			</div>
			<div class="box-footer">
				<div class="row">
					<div class="col-sm-offset-2 col-sm-10">
						<% if (hasPermi('wx:wxBusinessGroupOrgConfig:edit')){ %>
							<button type="submit" class="btn btn-sm btn-primary" id="btnSubmit"><i class="fa fa-check"></i> ${text('保 存')}</button>&nbsp;
						<% } %>
						<button type="button" class="btn btn-sm btn-default" id="btnCancel" onclick="js.closeCurrentTabPage()"><i class="fa fa-reply-all"></i> ${text('关 闭')}</button>
					</div>
				</div>
			</div>
		</#form:form>
	</div>
</div>
<% } %>
<script>
$("#inputForm").validate({
	submitHandler: function(form){
		js.ajaxSubmitForm($(form), function(data){
			js.showMessage(data.message);
			if(data.result == Global.TRUE){
				js.closeCurrentTabPage(function(contentWindow){
					contentWindow.page();
				});
			}
		}, "json");
    }
});

var id = '${wxBusinessGroupOrgConfig.id}';
if(id){

}else{
    $('#sortDiv').hide();
    $('#sortLogo').hide();
    $('#mainBusiness').hide();
}

</script>